﻿@model Telerik.Web.Mvc.GridModel<ProductVariantModel>
@using Telerik.Web.Mvc.UI

@{
    var gridPageSize = EngineContext.Current.Resolve<IT.CMS.Core.Domain.Common.AdminAreaSettings>().GridPageSize;

    //page title
    ViewBag.Title = T("Admin.Catalog.LowStockReport.Manage").Text;
}
@using (Html.BeginForm())
{
    <div class="section-header">
        <div class="title">
            <img src="@Url.Content("~/Areas/Admin/content/images/ico-catalog.png")" alt="" />
            @T("Admin.Catalog.LowStockReport.Manage")
        </div>
        <div class="options">
        </div>
    </div>

    <table class="adminContent">
        <tr>
            <td>
                @(Html.Telerik().Grid<ProductVariantModel>(Model.Data)
                    .Name("productvariants-grid")
                    .Columns(columns =>
                    {
                        columns.Bound(pv => pv.Name);
                        columns.Bound(pv => pv.Sku).Width(100);
                        columns.Bound(pv => pv.Price).Width(100);
                        columns.Bound(pv => pv.StockQuantity).Width(100);
                        columns.Bound(pv => pv.Published)
                            .Template(
                                @<img alt="" src="@Url.Content("~/Areas/Admin/content/images/active-" + item.Published.ToString().ToLowerInvariant() + ".gif")" />
                            )
                            .ClientTemplate("<img alt='' src='" + Url.Content("~/Areas/Admin/content/images/") + "active-<#= Published #>.gif' />")
                            .Centered()
                            .Width(100);
                        columns.Bound(x => x.Id)
                            .Width(50)
                            .Centered()
                            .Template(x => Html.ActionLink(T("Admin.Common.Edit").Text, "Edit", new { id = x.Id }))
                            .ClientTemplate("<a href=\"Edit/<#= Id #>\">" + T("Admin.Common.Edit").Text + "</a>")
                            .Title(T("Admin.Common.Edit").Text);
                    })
                    .Pageable(settings => settings.Total(Model.Total).PageSize(gridPageSize).Position(GridPagerPosition.Both))
                    .DataBinding(dataBinding => dataBinding.Ajax().Select("LowStockReportList", "ProductVariant"))
                    .EnableCustomBinding(true))
            </td>
        </tr>
    </table>
}